MK100K2a.txt in 75c BUILDING 100K MAPS FROM USGS DATA (This program used to be called MKMAPHK) Jack Cavanagh QBasic code to make APRS maps from USGS 100K:1 CD ROM Version 1.0 released 23 Oct 95 Version 2.0 Released 27 Dec 1995 Version 2a Bug Fix 15 Jan 96 Fixed file name bugs Edited by WB4APR on 17 Aprl 1996 Making APRS maps from the 100k CD is a two step process. First you use the CD programs to extract the raw map data from the CD to your hard drive. The second step is to run MK100K2a.EXE which pulls the information from the hard disk files. APRS distribution now includes one 2 mile map made using this program. Zoom into 3909N and 07636W below 2 miles. STEP ONE It is assummed that you have already installed the CD support software on your hard disk following the instructions that come with the CD readme files. Create a blank sub-directory on your hard drive to store the data. I use the directory name 'dlg'. Be sure you have enough room as 6 Meg or more of hard disk could be required. Now run the program "extract.exe". Do this from a maximum user application memory (>512k) DOS configuration. This means no shell programs and minimum memory resident stuff. If this is not the case the program will appear to run but no files will be written to your hard drive. The extract program will present you with a map of the area of the USA covered by the CD. At the top of the screen are various selection options. Use either the arrow keys and the enter keys or a mouse to select the "SELECT QUAD" option. Move the cursor to the region of interest and click or hit ENTER. The screen is redrawn with the selected grid divided into 15 minute grids. Major rivers are shown along with major town names. Now pick the option "SELECT LAYERS". A window will open and several options will be shown. Unless you have some special need, select only the hydrography and transportation layers. When you click the END SELECTION option, a "SELECT 15' GRID" option will become active. Select it. Move cursor to the regions of interest and click or hit ENTER. A window will open up showing how much of your hard drive space will be eaten up. Pick enough (usually up to four) grids that contain the area you want to make an APRS map off. If you like me live near a grid corner, four will be required for a home town map. In the case of Bob Bruninga, who lives near the border of two major grids, this process may have to be repeated to get the four nearest 15' grids for his home town map. Once you are satisfied with your selections, choose the "OUTPUT" option on the top bar. The program will ask for a path to the directory on the hard drive to store the data. After you respond, the program writes the info to hard drive. If this appears to only take a few seconds, you probably need more lower memory. Exit the program. This takes two steps from the 15' menu through the main menu. Now check to see if the files are on your hard drive in the designated directory. Make a note of the path to this directory. The mapping program will want this information. NOTHING BUT CD MAP FILES MUST BE IN THIS DIRECTORY. ANY OTHER FILE GUARANTEES A PROGRAM CRASH. There is no way to know in advance what file names will come from the CD. The program must try to process all files in the sub-directory. Please do NOT make any sub-sub-directory under the map file sub-directory either. STEP TWO Execute the file MK100K2a.exe ------------------------------------ For those who like to hack BASIC source code is available. Execute QBasic from the DOS prompt (or Windows if you must) with the large memory option. This is done with the switch /AH. Unfortunately the requirement to use this switch precludes the use of Quick Basic that comes with DOS. With all his money, Bill Gates really doesn't need to use bait and switch marketing. e.g. qb /ah I wrote a one line batch file map.bat: qb /ah MK100K2.bas Load the file MK100K2a.BAS. Run the BASIC code (Sh-F5). ------------------------------------- The program first asks for the path to the data files. I use 'c:\dlg'. Next you are asked if the files came from the CD or from the internet. The CD files are 82 byte records with a carriage return line feed and the internet files are only 80 bytes long. Any single answer other than "y" or "Y" will default to the 82 byte record length. Next you will be asked for a file name for the output. The code takes care of file extensions. For example, your response could be 'vafred' or 'mdannap'. ** Currently there is a bug, and you should ONLY enter a 6 character name *** Next you are asked for the latitude and longitude of the center of the APRS map. Enter this information in degrees and minutes. The APRS cursor is a good tool for identifying LAT/LONG. Decimal parts of the minutes are allowed e.g. 38,56.5 is the response for 38 degrees 56 minutes 30 seconds North latitude. Do this carefully. Your coordinates must fall within one of the 15 minute grids extracted in step one. The final user input is the map radius in nautical miles. This is actually one-half the North-South span of the map. The East-West span will be 4/3 times this value. The level of road detail is controlled by the value of your input. Interstate, U.S. Routes and major state routes will be extracted for all maps. Secondary state routes (Class 3) will be extracted once the radius falls below 8 miles. Class 4 roads, real local stuff, appear once the radius falls below 2 miles. You have some control over this. If the map radius is preceeded with a minus sign (-) then the default class of roads is decreased by one but not less than class 2. Use this in dense urban areas. If the map radius is preceeded with a plus sign (+) then the default class of roads is increased by one but not more than class 4. Use this technique in sparse rural areas to get more cross-road landmarks. MULTIPLE MAPS: You will be presented with an option to make more than one map during this session. You can make one, four or nine maps. A crude figure shows the relation of your input coordinates to the maps. For more that one map a two letter tag is added to the first six characters of your map file name. These tags are shown in the figure. The map radius still applies to each individual map. For the next 5 to 30 minutes the code will grind away. As map features are found they are plotted on the screen. A status line on the top shows progress in the form of the total number of lines in the data file, a rapidly changing number of lines examined thus far and the number of lines accumulated for the map. As each file is processed, the program start time and file finish time is updated. When all files have been processed, the code tries to link as many short segments as possible into longer segments. Progress is shown as the maps lines change color to white (temporarily). The results are reported on the screen as the number of line segments and map points. Finally at the stroke of a key the display will show the map as it would appear in APRS. Exit BASIC at this point and the default drive will contain two files with your file name and the extentions .dat and .map. The raw data file .dat can be reworked with the MAPFIX program to delete unwanted features and make a new .map file that fits APRS. There is also a file 'temp' which was used as a working file. This is over written each time the program is run. Hints and peculiarities: ** NOTE ** the .MAP output file is always less than 3000 points, but is usually so truncated as to be useless. DONT USE IT. The effect if barely noticable, until you zoom in to small features and city blocks where the right angle streets will be totally decimated....You should load the .DAT file into MAPFIX and tell it to TASK-SCRUNCH with a ratio of 1.2 (no more). This map then should be saved as .map once you get it below 3000 points. If it is below about 3500, I can usually find 500 points that can be eliminated using the +/- and EDIT-DELETE commands. Or you can TASK-TRIM to simply cut off themap edges... These maps have limited river and stream information. They are on the CD but if there is no internal coding to distinguish between a short little stream and a signifcant river unless the river had two distinct banks on the original maps. Single line width rivers and streams are just not extracted. What we are left with is every little pond that has a "shoreline". If these are not significant to you edit them out with MAPFIX command "Kill feature". The line attributes on the CD do not distinguish between coast lines, river banks or lake shorelines. All are colored in dim cyan. MK100K2a makes your map radius about 5% larger than the integer APRS scales of 1, 2, 4, 8, etc nautical miles. This is so that APRS will load the map at the indicated range with out a PERFECT placement of the cursor at the center. The USGS Data User's Guide implies that political boundary and public land survey data is on the CD. This is not the case for the optional format CD. If city or county lines are significant to you, import them with MAPFIX from a map made from the 2,000,000:1 CD. I encourage all those who make changes, improvements, bug fixes and enhancements to this code to document each change by adding a comment to each modified or added source code line. A simple 'v2 or your initials, callsign, etc 'jfc will do nicely. Some users have reported problems with no maps being produced. This appears to caused by a user map center and radius that does not fall within the region covered by the files. The already verbose error message has been expanded to reveal records 11 through 14 of the last file examined. These records define the four corners of the map data which can be compared with your input values to see were the mistake was made. It will be either a wrong map center or a bad choice of files. MK100k2a halves the number of points extracted for shorelines as a brute force reduction technique. Also some shorelines are so long, that MK100k2a can not find the beginnning or end in the data. If such a line is omitted though, it is usually very noticable. The big change in 2.0 was the choice of making one, four or nine maps at time. The maps are centered about the user's lat/long input. The user's map radius is increased by five percent internally so that the maps overlap. Remember the map data is based on 15 minute USGS maps, although 7.5 minute maps may have been digitized. The maps extend 15 nautical miles north-south everywhere. The east-west extent depends on latitude. For the continental United States, this can range between about 12.6 nautical miles for the Florida Keys down to about 9.8 nautical miles for International Falls, MN. An APRS map is 4/3 as wide as it is tall. Thus a 1 radius mile APRS map covers 2 nautical miles north-south and about 2.67 nautical miles east-west. My point here is that even a one mile map could require extracting data from as many as 4 each of the transportation and hydrography map files and typically require two sets of these map files. APR COMMENT. Due to the TALL 15 minute box of raw data, and the FAT wide APRS display format, a better extraction method is as follows: * * * * * * * Two 4.2 mile maps but ONLY if the area is very sparse * * * * ----------+---------- Eight 2.1 mile maps * - - - - - * | | | should cover most mid USA * * | | | latitudes quite well * * +--------(*)--------+ * * * * * * * | | | | | | +---------+---------+ | | | | | | +--------(*)--------+ | | | | | | ----------+---------- I have asked jack to consider this multiple map profile. In the mean time you can just select his 4 map option twice, once for the upper center of the 15 min cell, and again for the bottom center JACK's Thoughts on any future Version 3 - The multi-map production feature could be expanded to include 16 or 25 maps at once. However, drawing little boxes on the input screen is tedious, boring and not much fun. Does anyone have any ideas on how to identify each map when making this many at a time? - There are one or two bugs that cause a line segment to be missed now and then. If I transport this code to a faster machine (my wife's) I may be able to find and fix them. - I am still wary of how this code will perform in regions with extensive shorelines such as tidewater Virginia or Lousiana bayous. I need user feedback on this. - No Windows support is planned. Anyone skilled in Visual Basic or Visual C is more than welcome to take a crack at this. - If there is an overwhelming need for railroads, canals, trails, etc, a switch could be added. Comments, bugs and suggestions are welcome. Contact me by packet at kb4xf@kc4asf.va.usa.na on packet or 223 N. Randolph Rd., Falmouth, VA 22405 by snail mail. I will be on the Internet in a few months. Happy mapmaking and APRS operating, Jack, KB4XF Jack Cavanagh, KB4XF Falmouth, VA kb4xf@kc4asf.va.usa